<?php 
class CBaseUsers extends CBaseEosPlural {

	public function __construct() {		
		return true;
	}
	
	public static function fetchUsers( $objDatabase ) {
		$strSql = 'SELECT * FROM `users`';
		return parent::fetchResults( $strSql, 'CUser', $objDatabase );
	}
	
	public static function fetchUserById( $intId, $objDatabase ) {
		$strSql = 'SELECT 
						u.* 
					FROM 
						`users` AS u 
					WHERE 
						u.`id` = ' . $intId;
		return parent::fetchResult( $strSql, 'CUser', $objDatabase );
	}
		
	public static function fetchUserByUserNameByPassword( $strUserName, $strPassword, $objDatabase ) {
		$strSql = 'SELECT 
						u.* 
					FROM 
						`users` AS u 
					WHERE 
						u.`login_name` = \'' . $strUserName . '\'
						AND u.`password` = \'' . $strPassword . '\'' ;
		return parent::fetchResult( $strSql, 'CUser', $objDatabase );
	}
	
	public static function fetchUsersByUserTypeId( $intUserTypeId, $objDatabase ) {
		$strSql = 'SELECT 
						u.* 
					FROM 
						`users` AS u 
					WHERE 
						u.`user_type_id` = ' . $intUserTypeId;
		return parent::fetchResults( $strSql, 'CUser', $objDatabase );
	}
}

?>